<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
    <title>验证码</title>
    <!--<script th:src="@{/static/common/jquery.min.js(v=${version})}" type="text/javascript"></script>-->


    <!--<link th:href="@{/static/web/css/ie.css(v=${version})}" rel="stylesheet" type="text/css"/>-->

    <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
    <meta content="width=device-width, initial-scale=1.0" name="viewport">

    <!--框架样式-->
    <link rel="stylesheet" th:href="@{/static/captcha/bootstrap.min.css}" type="text/css">
    <!--图标样式-->
    <link rel="stylesheet" th:href="@{/static/captcha/all.min.css}" type="text/css">
    <!--主要样式-->
    <link rel="stylesheet" th:href="@{/static/captcha/slidercaptcha.css}" type="text/css">

    <style>
        .slidercaptcha {
            margin: 0 auto;
            width: 314px;
            height: 286px;
            border-radius: 4px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.125);
            margin-top: 40px;
        }

        .slidercaptcha .card-body {
            padding: 1rem;
        }

        .slidercaptcha canvas:first-child {
            border-radius: 4px;
            border: 1px solid #e6e8eb;
        }

        .slidercaptcha.card .card-header {
            background-image: none;
            background-color: rgba(0, 0, 0, 0.03);
        }

        .refreshIcon {
            top: -54px;
        }
    </style>
</head>
<body>
<div class="container-fluid">
    <div class="form-row">
        <div class="col-12">
            <div class="slidercaptcha card">
                <div class="card-header">
                    <span>请完成安全验证</span>
                </div>
                <div class="card-body">
                    <div id="captcha"
                         style="position: relative; width: 280px; margin: 0px auto;"></div>
                </div>
            </div>
        </div>
    </div>
    <img id="img1" src="" style="display: none;">
    <img id="img2" src="" style="display: none;">
    <script th:src="@{/static/captcha/jquery-1.11.0.min.js}" type="text/javascript"></script>
    <script th:src="@{/static/captcha/longbow.slidercaptcha.js}" type="text/javascript"></script>
    <script>
        var imgData;

        function reValidateDeal() {

            $.ajax({
                url: "/tiger-thymeleaf/captcha/getImageVerifyCode",
                dataType: 'json',
                cache: false,
                async: false,
                success: function (data) {
                    imgData = data;
                    $("#img1").attr('src', 'data:image/png;base64,' + imgData.bigImage);
                    $("#img2").attr('src', 'data:image/png;base64,' + imgData.smallImage);
                    initCaptchaIndex();
                }
            })

        }

        reValidateDeal();

        function initCaptchaIndex() {
            $('#captcha').sliderCaptcha({
                repeatIcon: 'fa fa-redo',
                setSrc: function () {
                    return 'http://images.sdgxgz.com/Pic' + Math.round(Math.random() * 136) + '.jpg';
                },
                onSuccess: function () {

                    alert('验证通过!');
                }
            });
        }


    </script>
</div>
</body>

</html>